{{define "demo02.html"}}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<script src="/static/jquery-1.8.0.js"></script>
<body>
    <form action="/testpost" method="post">
        用户名:<input type="text" name="username" id="username"><span id="msg"></span>
        密码:<input type="password" name="pwd">
            <input type="submit" value="提交">
    </form>
<script>
    var element = document.getElementById("username");
    element.onblur=function () {

        var value = element.value;
        console.log(value)
        $.ajax({
            url:"/testuname",
            type:"POST",
            data:{
                "uname":value
            },
            success:function (info) {
                document.getElementById("msg").innerText=info["msg"]
            },
            fail:function (info) {
                
            }
        })
    }

</script>
</body>
</html>
{{end}}
